<!--招聘-人才库-->
<template>
  <div class="rthcHead">
    <div class="rthcImg">
      <img src="@/assets/img/personnelImage/岗位需求库.png">
      <span class="rthcTi" title="人才库">人才库</span>
    </div>
    <div class="rthc-handle">
      <span class="rthc-handle-pri">
        <el-button type="primary">发送岗位推荐</el-button>
      </span>
      <span class="rthc-handle-more">
       <el-dropdown>
          <el-icon>
            <setting/>
          </el-icon>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item>发送岗位推荐</el-dropdown-item>
              <el-dropdown-item>新建</el-dropdown-item>
              <el-dropdown-item>删除</el-dropdown-item>
              <el-dropdown-item>修改</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </span>
    </div>
  </div>
  <div style="height: 100%; min-height: 235px;">
    <div style="background: white">
      <div class="rthcink">
        <span class="rthc-quickearch-label">
          岗位名称 :
        </span>
        <div class="rthc-quickearch-style">
          <el-input v-model="paging.pub_channel_id"
                    :value.async="positionName"
                    placeholder="岗位名称"
                    @focus="dialogTableVisible = true" @change="Visdemand"
                    @keyup.enter.native="Visdemand" clearable/>
        </div>
      </div>
      <div class="rthcink">
        <span class="rthc-quickearch-label">
          应聘人 :
        </span>
        <div class="rthc-quickearch-style">
          <el-input
              v-model="paging.id" placeholder="应聘人姓名"
              :value.async="name"
              @focus="fabuTabVis = true"
              @keyup.enter.native="Visdemand"
              @change="Visdemand" clearable/>
        </div>
      </div>
      <div class="rthcink">
        <span class="rthc-quickearch-label">
          人才级别 :
        </span>
        <div class="rthc-quickearch-style">
          <el-select v-model="paging.talent_level" placeholder="人才级别" @click="Visdemand">
            <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
            </el-option>
          </el-select>
        </div>
      </div>
    </div>
    <div class="rthc-list-table">
      <el-table
          ref="multipleTable"
          :data="tableData"
          tooltip-effect="dark"
          style="width: 100%"
          :header-cell-style="{background:'#F7FBFE',color:'#606266'}"
          @selection-change="handleSelectionChange">
        <el-table-column
            prop="id"
            type="selection"
            width="55">
        </el-table-column>
        <el-table-column
            prop="name"
            label="姓名"
            width="120">
        </el-table-column>
        <el-table-column
            prop="contactPhone"
            label="手机号码"
            width="120">
        </el-table-column>
        <el-table-column
            prop="resumeClassify.positionName"
            label="岗位匹配"
            show-overflow-tooltip>
        </el-table-column>
        <el-table-column
            prop="sex"
            label="性别"
            show-overflow-tooltip>
        </el-table-column>
        <el-table-column
            prop="resumeClassify.tag"
            label="标签"
            show-overflow-tooltip>
          <template #default="s">
            {{this.$dictMap.getLabel(`resume_tag:${s.row.resumeClassify.tag}`)}}
          </template>
        </el-table-column>
        <el-table-column
            prop="resumeClassify.talentLevel"
            label="人才级别"
            show-overflow-tooltip>
          <template #default="s">
            {{this.$dictMap.getLabel(`t_level:${s.row.resumeClassify.talentLevel}`)}}
          </template>
        </el-table-column>
<!--        <el-table-column-->
<!--            prop="resumeClassify.follow_up_type"-->
<!--            label="是否关注"-->
<!--            show-overflow-tooltip>-->
<!--        </el-table-column>-->
        <el-table-column
            label="操作"
            show-overflow-tooltip>
          <template #default="xx">
            <el-button  @click="edaLink">面试安排</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pag-block" style="">
        <el-pagination
            @current-change="handleCurrentChange"
            :total="paging.total"
            :page-size="paging.pageSize"
            :hide-on-single-page="hidePaging"
        >
        </el-pagination>
      </div>
    </div>
  </div>
  <el-dialog v-model="dialogTableVisible" title="应聘部门">
    <el-table :data="diatable" @row-click="bydiaval">
      <el-table-column property="value" label="编号" width="200"/>
      <el-table-column property="label" label="岗位" width="auto"/>
    </el-table>
  </el-dialog>
  <el-dialog v-model="fabuTabVis" title="发布人">
    <el-table :data="fabtable" @row-click="byfabval">
      <el-table-column property="id" label="编号" width="200"/>
      <el-table-column property="name" label="姓名" width="auto"/>
    </el-table>
  </el-dialog>
</template>

<script>
import {selByAll} from '../../../network/per/talentMan'
import {getDeptOptions} from "../../../network/sys/dept";
export default {
  data() {
    return {
      diatable:[],
      fabtable:[],
      dialogTableVisible:false,
      fabuTabVis:false,
      paging: {
        pageNum: 1,
        pageSize: 5,
        total: null,
        pub_channel_id:"",
        id:"",
        talent_level:null
      },
      positionName:"",
      hidePaging: false,
      options: [
        {
          value: null,
          label: ' '
        },
          {
        value: 1,
        label: '紧跟A类'
      }, {
        value: 2,
        label: '意向B类'
      }, {
        value: 3,
        label: '基础C类'
      }],
      value: '',
      restaurants: [],
      state: '',
      // 展示数据
      tableData: [],
      // 选中数据
      multipleSelection: []
    }
  },
  methods: {
    edaLink(){
      this.$router.push({
        path: '/per/interview-arrange'
      })
    },
    Visdemand(){
      selByAll(this.paging).then((das)=>{
        console.log("tpool",das)
        this.tableData = das.list;
        this.paging.total = das.total;
        this.paging.pageSize = das.pageSize;
        this.paging.pageNum = das.pageNum;
      })
    },
    // 选择岗位
    bydiaval(row) {
      this.positionName = row.label;
      this.paging.pub_channel_id = row.value;
    },
    // 选择应聘人员
    byfabval(row) {
      this.name = row.name;
      this.paging.pub_channel_id = row.id;
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    }
  },
  mounted() {
    // 数据初始化
    this.Visdemand();
    // 应聘人初始化
    selByAll(this.paging).then((das)=>{
      this.fabtable = das.list;
      this.paging.total = das.total;
      this.paging.pageSize = das.pageSize;
      this.paging.pageNum = das.pageNum;
    })
    //岗位初始化
    getDeptOptions().then(data => {
      this.$response.handle({
        data: data,
        successFn: () => {
          console.log("岗位初始化 -> ", data.data)
          this.diatable = data.data
        }
      })
    });
  }
}
</script>

<style lang="scss" scoped>
@import "../../../assets/css/personnelCss/RecruitHeadcount";
</style>